import {Injectable} from '@angular/core';
import {CanActivate, Router} from '@angular/router';
import {AuthenticationHelper} from '../app.authentication';

@Injectable()
export class LoginGuard implements CanActivate {

    constructor(private authService:AuthenticationHelper) {
    }

    canActivate() {
        if (!this.authService.isLoggedIn()) {
            this.authService.redirectToLogin();
            return false;
        } else {
            return true;
        }
    }

}
